#include "stdafx.h"
#include "AddObjectGui.h"

#include "Window.h"
#include "PushButton.h"

#include "WorldData.h"
#include "NodeUtil.h"

#include "GlobalAppData.h"

using namespace medit;

AddObjectGui::AddObjectGui(const mscene::WorldData & data)
{
	mWorld = data;

	GuiWindow = new mgui::Window(mgui::Rect(mcore::GlobalAppData::Instance.ScreenWidth - 220, 50, 200, 500), "Add object");

	mgui::PushButton * button;

	//button = new mgui::OnOffButton(mgui::Rect(10, 30, 160, 20), "Show G-buffer");
	//button->addListener(mgui::OnOffButton::EVENT_STATE_CHANGED, std::bind(&RenderSettingsGui::buttonShowGBuffer, this, std::placeholders::_1));
	//GuiWindow->addChild(button);

	//button = new mgui::OnOffButton(mgui::Rect(10, 60, 160, 20), "Show bounding geo");
	//button->addListener(mgui::OnOffButton::EVENT_STATE_CHANGED, std::bind(&RenderSettingsGui::buttonShowBoundingGeo, this, std::placeholders::_1));
	//GuiWindow->addChild(button);

	//button = new mgui::OnOffButton(mgui::Rect(10, 90, 160, 20), "Render SSAO");
	//button->addListener(mgui::OnOffButton::EVENT_STATE_CHANGED, std::bind(&RenderSettingsGui::buttonRenderSSAO, this, std::placeholders::_1));
	//GuiWindow->addChild(button);

	button = new mgui::PushButton(mgui::Rect(10, 30, 160, 20), "Plane");
	button->addListener(mgui::PushButton::EVENT_PUSHED,
		std::bind(&AddObjectGui::buttonPlaneClicked, this, std::placeholders::_1));
	GuiWindow->addChild(*button);

	button = new mgui::PushButton(mgui::Rect(10, 60, 160, 20), "Box");
	button->addListener(mgui::PushButton::EVENT_PUSHED,
		std::bind(&AddObjectGui::buttonBoxClicked, this, std::placeholders::_1));
	GuiWindow->addChild(*button);

	button = new mgui::PushButton(mgui::Rect(10, 90, 160, 20), "Sphere");
	button->addListener(mgui::PushButton::EVENT_PUSHED,
		std::bind(&AddObjectGui::buttonSphereClicked, this, std::placeholders::_1));
	GuiWindow->addChild(*button);

	button = new mgui::PushButton(mgui::Rect(10, 120, 160, 20), "Point light");
	button->addListener(mgui::PushButton::EVENT_PUSHED,
		std::bind(&AddObjectGui::buttonPointLightClicked, this, std::placeholders::_1));
	GuiWindow->addChild(*button);

	button = new mgui::PushButton(mgui::Rect(10, 150, 160, 20), "Spot light");
	button->addListener(mgui::PushButton::EVENT_PUSHED,
		std::bind(&AddObjectGui::buttonSpotLightClicked, this, std::placeholders::_1));
	GuiWindow->addChild(*button);
}

void AddObjectGui::buttonPlaneClicked( const mgui::EventArgs & args )
{
	mscene::PrimitiveNodeDesc desc;
	mscene::createPlaneNode(desc, mWorld);
}

void AddObjectGui::buttonBoxClicked( const mgui::EventArgs & args )
{
	mscene::PrimitiveNodeDesc desc;
	mscene::createBoxNode(desc, mWorld);
}

void AddObjectGui::buttonSphereClicked( const mgui::EventArgs & args )
{
	mscene::PrimitiveNodeDesc desc;
	mscene::createSphereNode(desc, mWorld);
}

void AddObjectGui::buttonPointLightClicked( const mgui::EventArgs & args )
{

}

void AddObjectGui::buttonSpotLightClicked( const mgui::EventArgs & args )
{

}